package com.gq.business.commoncontroller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import com.gq.common.utils.HttpUtils;
import com.gq.config.RetunCode;
import com.gq.config.ServiceConfig;

/**
 * 
 * app 服务入口 负责分发app端的请求.
 * 
 * @author Administrator
 * @version [version, 2016年1月7日]
 * @see [relevant class/method]
 * @since [product/module version]
 */
@Controller
public class CommonController
{
    
    @SuppressWarnings("finally")
    @RequestMapping("common")
    public String common(@RequestBody CommonRequest rquest, HttpServletResponse response)
    {
        /*
         * 判断服务是否可用
         */
        String serviceid = rquest.getHeader().getServceid();
        try
        {
            /*
             * 跳转
             */
            ServiceConfig.valueOf(serviceid);
            return "forward:" + serviceid;
        }
        catch (Exception e)
        {
            HttpUtils.responseJson(response, RetunCode.service_notfond);
        }
        
        finally
        {   
           
        
        }
        return "";
      
        
        /*
         * log
         */
        /*
         * 鉴权
         */
       
     
    }
}
